package src.A_JavaBase;

import java.util.Scanner;

public class Demo03 {

    public static void main(String[] args) {
        double sum = 0, sum2 = 0;
        System.out.println("请输入：");
        for (int i = 0; i<3; i++){
            try {
                Scanner scanner = new Scanner(System.in);
                sum+=scanner.nextDouble();
                sum2 = sum;
            }catch (Exception e){
                sum  = sum2;
                i--;
                System.out.println("请输入数字：");
                continue;
            }
        }
        System.out.println("和为："+sum);
    }
}
